package com.hsnn.medstgmini.trading.pur.service.impl;


import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hsnn.medstgmini.model.IsStatus;
import com.hsnn.medstgmini.trading.pur.dao.OrderNotConfirmDteailDao;
import com.hsnn.medstgmini.trading.pur.model.OrderPackStatus;
import com.hsnn.medstgmini.trading.pur.model.PurOrderInfo;
import com.hsnn.medstgmini.trading.pur.model.form.OrderPack;
import com.hsnn.medstgmini.trading.pur.service.OrderNotConfirmDteailManager;
import com.hsnn.medstgmini.util.Pagination;
import com.hsnn.medstgmini.util.ParseDate;
import com.hsnn.medstgmini.util.ParseNumber;
@Service
public class OrderNotConfirmDteailManagerImpl implements OrderNotConfirmDteailManager {
	

	@Autowired
	private OrderNotConfirmDteailDao orderNotConfirmDteailDao;
	
	@Resource(name = "sessionFactory")
	private SessionFactory factory;
	/**
	 * 
	 * @category 获取审核未通过订单信息列表数据（医疗机构）
	 * @author 王立志
	 * @date 2016年4月10日
	 * @param page
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public Pagination getPurOrderNotConfirmDteai(Pagination page) {
		page = orderNotConfirmDteailDao.getPurOrderNotConfirmDteailList(page);
		List<Map<String, Object>> list =(List<Map<String, Object>>) page.getRows();
		if (null != list && list.size() > 0) {
			for (int i = 0; i < list.size(); i++) {
				Map<String, Object> map = list.get(i);
				map.put("submitDatetime",
						map.get("submitDatetime") == null ? "" : ParseDate
								.parseFullFormat(ParseDate.fromFullFormat(map
										.get("submitDatetime").toString())));
				map.put("amount",
						map.get("amount") == null ? "0.00" : ParseNumber
								.toStrDecimal(ParseNumber.toDouble(map.get(
										"amount").toString())));

				map.put("count",
						map.get("count") == null ? "0" : map.get("count")
								.toString());
				map.put("isUrgent",
						map.get("isUrgent") == null ? "" : "1".equals(map.get("isUrgent").toString())?IsStatus.yes.getValue():IsStatus.no.getValue());
				map.put("orderStatus",OrderPackStatus.getName(Integer.parseInt(String.valueOf(map.get("orderStatus")))));
						
			}
		}
		return page;

	}
	@Override
	public Pagination getPurOrderNotConfirmDteail(Pagination page) {
		
		return null;
	}
	@Override
	public void delete(List<OrderPack> list) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void batchModifyData(List<PurOrderInfo> list) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void orderDelete(List<PurOrderInfo> list) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void orderPass(List<OrderPack> list) {
		// TODO Auto-generated method stub
		
	}


		}


